import dom, { ajax, domg } from "../../init.js";
import { obj } from "../../index.js";

export default {
  userlistright(e: Event) {
    const ele = this as unknown as HTMLElement;
    const index = ele.getAttribute("index");
    console.log(typeof index);

    const che = domg(`.userlist input:nth-of-type(${index})`);
    if (che === e.target) {
      console.log("ok");
    }
  },
  async clickbtn() {
    const id = +(this as any).parentElement.getAttribute("key");
    const isvip = (this as any).parentElement?.querySelector(
      ".andmiUserRight"
    ).checked;
    const result = await ajax.post("/user/rightchange", {
      id,
      right: isvip ? "2" : "3",
    });
    console.log(JSON.parse(result as string));
  },
};
